<%@ page language="java" import="java.util.*,shop.dao.*,shop.entity.*"  pageEncoding="utf-8"%>
<%
        String a_ID=request.getParameter("a_ID");
		String a_name = request.getParameter("a_name");
		String a_pass = request.getParameter("a_pass");
		String a_phone = request.getParameter("a_phone");
       String a_email = request.getParameter("a_email");

		Admin admin=new Admin();
		admin.setA_ID(a_ID);
		admin.setA_name(a_name);
		admin.setA_pass(a_pass);
		admin.setA_phone(a_phone);
		admin.setA_email(a_email);

		AdminDao admindao = new AdminDao();
        if(admindao.findname(a_name)==false){
            out
			.print("<script type='text/javascript'>alert('名字不可用。');history.go(-1);</script>");
     	}
     	else{
     	int count = admindao.updateAdmin(admin);
         		if (count > 0)
			out
			.print("<script type='text/javascript'>alert('成功更新管理员。');history.go(-2);</script>");
		else
			out
			.print("<script type='text/javascript'>alert('更新失败。');history.go(-1);</script>");
     	}
%>